package com.zyh.flower;

import java.util.Scanner;

/*
    这是鲜花商城的首页
 */
public class FlowerIndex {
    public static final Scanner INPUT = new Scanner(System.in);

    //    定义静态FlowerOder类型数组
    public static final FlowerOrder[] orderList = new FlowerOrder[5];

    //准备操作对象
    public static final FlowerServiceImpl serviceImpl = new FlowerServiceImpl();

    //    初始化数组
    static {
        orderList[0] = new FlowerOrder("1001", "金色海岸-香槟玫瑰", 10, 318.0, "2016-12-12", "王二妮", " ");
        orderList[1] = new FlowerOrder("1002", "初心永不变-白玫瑰", 99, 538.0, "2016-12-20", "张馨予", " ");
        orderList[2] = new FlowerOrder("1003", "梦里花开-紫色桔梗", 40, 148.0, "2016-12-24", "王二妮", " 烟波如水...");
        orderList[3] = new FlowerOrder("1004", "心花怒放-粉香百合", 120, 188.0, "2016-12-26", "王二妮", "内层银灰色");
        orderList[4] = new FlowerOrder("1005", "致青春-无声的爱", 100, 219.0, "2016-12-18", "张馨予", "我爱你，胜过爱爱情");
    }

    public static void main(String[] args) {
        outer:
        while (true) {
            System.out.println("==============================欢迎来到\"七彩鲜花\"商城=========================================");
            System.out.println("1.查询所有销售订单");
            System.out.println("2.修改销售订单");
            System.out.println("3.删除销售订单");
            System.out.println("4.增加销售订单");
            System.out.println("5.退出系统");
            System.out.println("============================================================================================");
            System.out.println("请输入您的选择：");
            int choice = INPUT.nextInt();
            switch (choice) {
                case 1://查询时所有订单功能 findAll()
                    serviceImpl.findAll();
                    break;
                case 2://修改订单功能 update()
                    serviceImpl.update();
                    break;
                case 3://删除订单功能 delete()
                    serviceImpl.delete();
                    break;
                case 4:
                    serviceImpl.add();
                    break;
                default:
                    System.err.println("系统退出！");
                    break outer;
            }
        }
    }
}
